#!/var/bin/bash
# -*- coding: utf-8 -*-
import os
import time

import matplotlib
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
import matplotlib.dates as mdates
from matplotlib.patches import ConnectionPatch
import numpy as np
import pandas as pd

# zhfont = matplotlib.font_manager.FontProperties(fname='/usr/share/fonts/truetype/arphic/uming.ttc')


zhfont = matplotlib.font_manager.FontProperties(fname='/usr/share/fonts/truetype/arphic/ukai.ttc')


class DataAnalysisManager(object):

    def histogram_generation(self, value_list, mean, std):
        """
        直方图生成
        :param std:
        :param mean:
        :param value_list:
        :return:
        """
        """
        Plt.hist(x,bins=10,range=None,normed=False,weights=None,cumulative=False,bottom=None,histtype=’bar’,
                align=’mid’,orientation=’vertical’,rwidth=None,log=False,color=None,edgecolor=None,label=None,stacked=False)
            1）、x:指定要绘制直方图的数据。
            2）、bins：指定直方图条形的个数。
            3）、range：指定直方图数据的上下界，默认包含绘图数据的最大值和最小值。
            4）、normed：是否将直方图的频数转换成频率。
            5）、weights：该参数可为每一个数据节点设置权重。
            6）、cumulative：是否需要计算累积频数或频率。
            7）、bottom：可以为直方图的每个条形添加基准线，默认为0.
            8）、histtype：指定直方图的类型，默认bar，其他八日stacked、step和stepfilled。
            9）、align：设置条形边界的对齐方式，默认mid,另外left和right。
            10）、orientation：设置直方图的摆放方向，默认vertical垂直方向。
            11）、rwidth：设置直方图条形的宽度。
            12）、log：是否需要对绘图数据进行log变换。
            13）、color：设置直方图的填充色。
            14）、edgecolor：设置直方图边框色。
            15）、label：设置直方图的标签，可通过legend展示图例。
            16）、stacked：当有多个数据时，是否需要将直方图呈堆叠摆放，默认水平摆放。
        """

        fig, ax = plt.subplots()
        n, bins, patches = ax.hist(value_list, 30, density=False, edgecolor="#000000")
        # y = norm.pdf( bins, mean, std) * (np.max(n) - np.min(n))
        cc = 90
        dd = 90
        line_max = ax.viewLim.ymax
        lower_min = 0
        upper_min = 0
        for i, number in enumerate(bins):
            if abs(number - 3.6) < cc:
                cc = abs(number - 3.6)
                lower_min = n[i] / line_max
            if abs(number - 4.4) < dd:
                dd = abs(number - 4.4)
                upper_min = n[i] / line_max
                # print(upper_min)

        y = ((1 / (np.sqrt(2 * np.pi) * std)) * np.exp(-0.5 * (1 / std * (bins - mean)) ** 2)) * line_max
        ax.plot(bins, y, '-')
        ax.axvline(3.6, ymin=lower_min, c="g", ls='--', label='3.6')
        ax.axvline(4.4, ymin=upper_min, c="r", ls='--', label='4.4')
        textstr = '\n'.join((
            r'均值=%.2f' % mean,
            r'标准差=%.2f' % std,
            r'N = %d' % len(value_list)))
        props = dict(boxstyle='round', facecolor='wheat', alpha=0.5)
        ax.text(1.05, 0.95, textstr, transform=ax.transAxes, fontsize=12,
                verticalalignment='top', bbox=props, fontproperties=zhfont)
        ax.set_xlabel('异形比', fontproperties=zhfont)
        ax.set_ylabel('频率', fontproperties=zhfont)
        ax.set_title('异形比的直方图\n', fontproperties=zhfont)

        fig.tight_layout()
        ax.legend()
        # plt.show()
        file_name = "histogram.png"
        plt.savefig(file_name, format="svg")
        return os.path.abspath(file_name)

    def random_normal_distribution(self, x, mu, sigma):
        """
        生成符合要求的正态分布数组
        :param x:
        :param mu:
        :param sigma:
        :return:
        """
        # 根据均值、标准差,求指定范围的正态分布概率值
        # 关于seed()函数用法：
        # seed( ) 用于指定随机数生成时所用算法开始的整数值。
        # 1.如果使用相同的seed( )值，则每次生成的随即数都相同；
        # 2.如果不设置这个值，则系统根据时间来自己选择这个值，此时每次生成的随机数因时间差异而不同。
        # np.random.seed(19680801)
        # mean = 100  # 平均值
        # std = 15  # 标准差
        # x = mean + std * np.random.randn(437)
        # num_bins = 50

        pdf = np.exp(-((x - mu) ** 2) / (2 * sigma ** 2)) / (sigma * np.sqrt(2 * np.pi))
        return pdf

    @staticmethod
    def pie_generation(x, labels):
        """
        饼图生成
        :return:
        """
        """
        pie(x, explode=None, labels=None, colors=None, autopct=None, pctdistance=0.6, shadow=False, labeldistance=1.1, startangle=0, radius=1, 
        counterclock=True, wedgeprops=None, textprops=None, center=(0, 0), frame=False, rotatelabels=False, *, normalize=True, data=None)
        Parameters
            x:1维数组
                楔体数据
            explode：array-like, default: None
                如果没有，则是一个len（x）数组，用于指定偏移每个楔体的半径分数。
            labels：list, default: None
                为每个楔块提供标签的一系列字符串
            colors：array-like, default: None
                饼图将循环的一系列颜色。如果没有，将使用当前活动周期中的颜色。
            autopct：None or str or callable, default: None
                如果为空，一个字符串或函数，用于用其标记楔体数值。标签将放置在楔子内。如果是格式字符串，则标签将为fmt%pct。如果是函数，则将调用它。      
            pctdistance：float, default: 0.6
                每个饼图切片的中心与AutoCT生成的文本开始之间的比率。如果AutoCT为无，则忽略。
            shadow:bool, default: False
                在馅饼下面画一个阴影。
            normalize:bool, default: True
                如果为True，则始终通过规范化x来生成完整饼图，使总和（x）==1。如果总和（x）<=1，则为False生成部分饼图，并为总和（x）大于1引发ValueError。
            labeldistance:float or None, default: 1.1
                绘制饼图标签的径向距离。如果设置为“无”，则不会绘制标签，而是将其存储以供在legend()中使用
            startangle:float, default: 0 degrees
                饼图起点相对于x轴逆时针旋转的角度。
            radius:float, default: 1
                饼图的半径。  
            counterclock:bool, default: True
                指定分数方向，顺时针或逆时针。
            wedgeprops：dict, default: None
                传递给制作饼图的楔形对象的参数的Dict。例如，可以传入wedgeprops={linewidth:3}，将楔形边框线的宽度设置为3。
                有关更多详细信息，请查看wedge对象的doc/arguments。默认情况下，clip_on=False。
            textprops：dict, default: None
                传递给文本对象的参数的Dict。
            center：(float, float), default: (0, 0)
                图表中心的坐标。
            frame：bool, default: False
                如果为true，则用图表绘制轴框架。
            rotatelabels:bool, default: False
                如果为true，则将每个标签旋转到相应切片的角度。
            data:indexable object, optional
                如果给定，以下参数也接受字符串s，该字符串被解释为data[s]（除非这引发异常）：x, explode, labels, colors
            """
        labels = ('1', '2')
        x = [50, 50]
        explode = (0, 0.3)

        x1 = [10, 20, 20]
        labels1 = ('Hogs', 'Dogs', 'Logs')
        # explode1 = (0, 0, 0)
        fig, (ax1, ax2) = plt.subplots(1, 2)
        radius = 1.5
        startangle = x[1] * 1.8
        wedges, *_ = ax1.pie(x, explode=explode, labels=labels, autopct='%1.1f%%', pctdistance=0.5, labeldistance=1.1,
                             normalize=True,
                             shadow=True, startangle=startangle, counterclock=True, frame=False, rotatelabels=False)
        ax2.pie(x1, labels=labels1, autopct=lambda p: '{:,.1f}%'.format(p * sum(x1) / 100),
                pctdistance=0.5, labeldistance=1.1, radius=radius,
                normalize=True,
                shadow=True, startangle=0, counterclock=True, frame=False, rotatelabels=True)

        width = 0.5

        theta1, theta2 = wedges[0].theta1, wedges[0].theta2
        center, r = wedges[0].center, wedges[0].r

        # draw top connecting line
        x = r * np.cos(np.pi / 180 * theta1) + center[0]
        y = r * np.sin(np.pi / 180 * theta1) + center[1]
        con = ConnectionPatch(xyA=(-width / 2, radius), coordsA=ax2.transData,
                              xyB=(x, y), coordsB=ax1.transData)
        con.set_color([0, 0, 0.1])
        con.set_linewidth(0.4)
        con.set_linestyle("--")
        ax2.add_artist(con)
        #
        # # draw bottom connecting line
        x = r * np.cos(np.pi / 180 * theta2) + center[0]
        y = r * np.sin(np.pi / 180 * theta2) + center[1]
        con = ConnectionPatch(xyA=(-width / 2, -radius), coordsA=ax2.transData,
                              xyB=(x, y), coordsB=ax1.transData)

        con.set_color([0, 0, 0.1])
        con.set_linestyle("--")
        con.set_linewidth(0.4)
        ax2.add_artist(con)
        # ax.axis('equal')  # Equal aspect ratio ensures that pie is drawn as a circle.

        plt.show()

    @staticmethod
    def bar_generation(label_value, labels):
        """
        生成一个柱状图。
        :param label_value:
        :param labels:
        :return:
        """
        """
        这些条按给定的对齐方式定位在x处。 它们的尺寸由高和宽给出。 垂直基线是底部(默认0)。
        许多参数可以是应用于所有条的单个值，也可以是应用于每个条的一系列值。
        bar(x, height, width=0.8, bottom=None, *, align='center', data=None, **kwargs)
        Parameters：
            x: float or array-like  x坐标轴条。 请参见“对齐”以了解条形图与坐标的对齐方式。
            height： float or array-like  条轴的高度
            width：float or array-like  条轴的宽度，默认为0.8
            bottom：float or array-like, y坐标的基准，默认为0
            align：{'center', 'edge'}, 将条形图与x坐标对齐:
                        'center':将基础置于x位置的中心。
                        'edge':将条的左侧边缘与x位置对齐。
                        要对齐右边的条，请输入负的宽度，并输入align='edge'。
        Other Parameters：
            color：color or list of color, optional 条轴颜色
            edgecolor:color or list of color, optional 条轴边框颜色
            linewidth：float or array-like, optional 条轴边框宽度 为0，不花边框
            tick_label：str or list of str, optional 条形图的标签。 默认值:无(使用默认数值标签)
            xerr, yerr:float or array-like of shape(N,) or shape(2, N), optional
            ecolor：color or list of color, default: 'black'   错误条的线颜色。
            capsize：float, default: rcParams["errorbar.capsize"] (default: 0.0)   误差杆的长度以点为单位。
            capsize：float, default: rcParams["errorbar.capsize"] (default: 0.0)   误差杆的长度以点为单位。
        """
        x = np.arange(len(labels))
        fig, ax = plt.subplots()
        rects1 = ax.bar(x, label_value, 0.3, color='#ff0000')
        ax.set_xticks(x, labels, fontproperties=zhfont)
        ax.set_title('缺陷平均处理时长\n', fontproperties=zhfont, fontsize=20)
        ax.set_ylabel('时长（分钟）', fontproperties=zhfont)
        ax.bar_label(rects1, padding=2)
        fig.tight_layout()
        plt.show()
        plt.close()

    @staticmethod
    def plot_generation(x, y, label):
        """
        生成一个折线图
        :param x:
        :param y:
        :return:
        """
        """
        plot(*args, scalex=True, scaley=True, data=None, **kwargs)
        Parameters:
            x, y: array-like or scalar
                数据点的水平/垂直坐标。 x值是可选的，默认为range(len(y))。通常，这些参数是一维数组。它们也可以是标量或二维的（在这种情况下，列表示单独的数据集）。这些参数不能作为关键字传递。

            fmt：str, optional
                格式字符串，例如红色圆圈的“ro”。有关格式字符串的完整说明，请参阅注释 部分。格式字符串只是快速设置基本行属性的缩写。所有这些以及更多也可以通过关键字参数来控制。
                此参数不能作为关键字传递。
            data：indexable object, optional
                带有标签数据的对象。如果给定，请提供要在x和y中绘制的标签名称。

        Other Parameters：
            scalex, scaley：bool, default: True
                这些参数确定视图限制是否适应数据限制。值被传递给autoscale_view.

            **kwargsLine2D properties, optional：
                kwargs用于指定线标签（用于自动图例）、线宽、抗锯齿、标记面颜色等属性。例子：
                    plot([1, 2, 3], [1, 2, 3], 'go-', label='line 1', linewidth=2)
                    plot([1, 2, 3], [1, 4, 9], 'rs', label='line 2')
                如果您在一次绘图调用中指定多行，则 kwargs 适用于所有这些行。如果标签对象是可迭代的，则每个元素都用作每组数据的标签。
                以下是可用Line2D属性的列表：

                Property                            Description
                ------------------------------------------------------------------------------------------------------------
                agg_filter                          一个过滤函数，它接受一个 (m, n, 3) 浮点数组和一个 dpi 值，并返回一个 (m, n, 3) 数组
                alpha                               标量或无
                animated                            bool
                antialiased or aa                   bool
                clip_box                            Bbox
                clip_on                             bool
                clip_path                           Patch or (Path, Transform) or None
                color or c                          color
                dash_capstyle                       CapStyle或 {'butt', 'projecting', 'round'}
                dash_joinstyle                      JoinStyle或 {'miter', 'round', 'bevel'}
                dashes                              浮动序列（以点为单位的开/关墨水）或（无，无）
                data                                (2, N) 数组或两个一维数组
                drawstyle or ds                     {'default', 'steps', 'steps-pre', 'steps-mid', 'steps-post'}，默认值：'default'
                figure                              Figure
                fillstyle                           {'full', 'left', 'right', 'bottom', 'top', 'none'}
                gid                                 str
                in_layout                           bool
                label                               object
                linestyle or ls                     {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
                linewidth or lw                     float
                marker                              标记样式字符串，Path或MarkerStyle
                markeredgecolor or mec              color
                markeredgewidth or mew              float
                markerfacecolor or mfc              color
                markerfacecoloralt or mfcalt        color
                markersize or ms                    float
                markevery                           无或 int 或 (int, int) 或 slice 或 list[int] 或 float 或 (float, float) 或 list[bool]
                path_effects                        AbstractPathEffect
                picker                              浮动或可调用[[Artist, Event], tuple[bool, dict]]
                pickradius                          float
                rasterized                          bool
                sketch_params                       (scale: float, length: float, randomness: float)
                snap                                bool or None
                solid_capstyle                      CapStyle or {'butt', 'projecting', 'round'}
                solid_joinstyle                     JoinStyle or {'miter', 'round', 'bevel'}
                transform                           unknown
                url                                 str
                visible                             bool
                xdata                               1D array
                ydata                               1D array
                zorder                              float
        """
        # %Y-%m-%d %H:%M:%S
        times = 100
        time_int = int(time.time())
        # time_int = 1659584429
        fig, ax = plt.subplots()
        x = np.array([time.strftime("%d %H:%M:%S", time.localtime(time_int + i * 45)) for i in range(times)])
        y = np.array([[i + 1, i + 200, i + 300, i + 60] for i in range(times)])
        interval = times * 10000
        plt.gca().xaxis.set_major_locator(mdates.SecondLocator(interval=interval))
        plt.xticks(rotation=45)
        ax.yaxis.set_major_formatter(mticker.FormatStrFormatter('%.0f%%'))
        ax.plot(x, y, "--", label=("<0.5mm", "0.5-1mm", "1-2mm", ">2mm"))
        ax.legend()
        fig.tight_layout()
        fig.align_ylabels()
        plt.show()


if __name__ == '__main__':
    value = [(115.72215264322557, 32.397292163214374), (106.28141506524666, 34.10513663517423),
             (116.90867837256381, 32.429068164962004), (116.16901890567509, 34.68974498647781),
             (103.24019647944705, 41.32401742681724), (113.33731124718412, 31.36656553510055),
             (108.00469780785757, 34.903374957432085), (104.94115032866483, 35.42333139564094),
             (108.39249824696937, 34.284131513091396), (109.5152903389886, 36.77371232099271),
             (107.1035691057146, 33.977243914276706), (117.20626821264786, 33.14494412882334),
             (111.6015463581421, 40.74126488400929), (109.63065382909068, 28.743928318544736),
             (105.53980568494642, 35.14815141967748), (111.07947859414946, 37.7002670448353),
             (108.66309339983778, 36.148769012777805), (114.54361087932502, 39.888906118167114),
             (114.7743189976238, 33.785789688179804), (126.47548805281579, 30.910614859169605),
             (112.42853403697082, 34.75077533684424), (121.98858747869149, 31.6699709547464),
             (105.43345353470013, 36.19960049119435), (106.10263171260586, 36.73119296473795),
             (113.19948109330802, 31.638607850380772), (122.13128162059714, 37.39129503520325),
             (105.1073123265721, 34.87691636737922), (116.46112910672943, 33.862772164722834),
             (117.19701304067999, 31.526366928371488), (121.0454261606738, 33.313589588846405),
             (116.67395295368534, 35.38947358621737), (116.42667466236159, 33.22958482819964),
             (108.6480892576238, 32.01092607180984), (105.61289834622815, 32.81168314686126),
             (110.31116518167912, 34.62706897981113), (111.09624342093387, 31.57786391568611),
             (119.4760227616699, 35.76705947481079), (112.6752443796105, 35.799386346528),
             (120.00549518244728, 35.52278045776807), (117.0377998308291, 33.16562285606779),
             (117.70629599791552, 35.94172202145735), (117.74141524585737, 29.010951994491887),
             (117.42335594696196, 34.31867532948865), (106.69491213987277, 24.960820023869893),
             (112.77506606415429, 37.80330134421357), (119.37805684902241, 38.95480394007659),
             (110.57724429782479, 33.83421552993107), (117.40539137889293, 32.968368482428055),
             (113.93598006163353, 33.96390872144072), (112.71908677826451, 37.36968096892431),
             (103.84806127726395, 36.605035066799985), (105.1745002613816, 22.764912553028278),
             (88.64157885788643, 35.49327116701304), (127.79087951041097, 28.54507172554234),
             (108.40207871478327, 32.10578721986234), (112.80716296159652, 32.12371154456508),
             (123.0400550542578, 35.480488839005936), (132.25494266048378, 29.209730798761633),
             (112.10626805119618, 31.10256850756651), (118.17481601121698, 29.385644901016974),
             (119.09198237219667, 27.042007239972367), (96.31223256397885, 33.149827885789854),
             (119.01510150416397, 29.828425052775785), (119.77353223788533, 30.314444142434535),
             (116.05333750126651, 39.76257270805108), (109.51889264692694, 32.98087396153971),
             (114.9214867990158, 32.88821968881852), (115.63300413301302, 25.676126641363613),
             (119.73678027004854, 36.400092004729466), (118.62093929100047, 29.83283272666521),
             (115.46631502350674, 27.50325649580359), (107.74001814924966, 31.44257977428975),
             (116.08849298273502, 32.42627102214508), (119.7822605696385, 33.1361442106271),
             (106.94454559712861, 27.59513354895841), (100.29837734172476, 23.50023808024517),
             (122.94994782711782, 31.765862885565696), (114.82268541431063, 31.951969580118014),
             (101.66107237445951, 24.626903871167457), (115.68936458826643, 30.85635763969969),
             (103.16813314420143, 31.438715164763355), (115.7778591180994, 36.759357010555746),
             (115.41083679267105, 31.463224457474766), (113.72544807115825, 27.43773321456775),
             (112.82651340668258, 31.3031204006204), (117.86543862819157, 31.484259687878957),
             (115.16172856506304, 30.23888006601157), (119.75791042440339, 31.157540489968483),
             (119.79737854577455, 37.19550682455059), (108.36766865868738, 27.577368051644807),
             (115.80953508234175, 34.686492161983765), (113.63059906227045, 32.73157404078754),
             (112.48364120791187, 35.154662454622084), (109.61588777166753, 33.16702288321708),
             (112.42424136518663, 29.237122803624576), (117.99770994411918, 31.59666848314881),
             (123.71690071339631, 25.517084750274662), (118.53448938712535, 26.400058938489888),
             (113.39848853139675, 33.33457060592196), (112.02959731467597, 26.78983580336119),
             (114.88382825171368, 32.359736353113114), (117.90479812611672, 29.589588969376866),
             (117.76552821315101, 29.162163981738445), (101.15190294652653, 32.493651989677225),
             (130.223283366018, 29.762363696874818), (115.88239551096645, 24.767672326227274),
             (110.22822795388984, 29.5693176233435), (116.64772085084827, 29.185101641121257),
             (117.59286261589126, 32.29773738541009), (114.88806138537535, 28.128991840123486),
             (117.88081588612137, 29.91596624974639), (114.8036026685392, 31.5999842825433),
             (108.58414474227199, 26.20660341388102), (117.44677907430415, 39.090748441275274),
             (108.74214552037203, 26.880346180985523), (114.3642491915979, 33.233381946377555),
             (117.3361979238939, 39.47280131569214), (96.939033005846, 33.21491896690304),
             (113.94988273125705, 32.36937389553755), (98.33348654644308, 23.91913740190118),
             (107.63393183241674, 30.53920157261957), (121.38295334186536, 33.455155336309865),
             (125.94403140384846, 33.81233709503422), (119.0203847387827, 28.870847310543397),
             (112.20060199485529, 32.653341395824185), (113.80953873272018, 28.556777452935858),
             (103.08022615801896, 27.581011899968367), (114.18348746413129, 30.63513847558),
             (114.7456930694899, 36.02694258657541), (105.65904377503597, 31.62514779666783),
             (118.31373749231489, 32.6567099864981), (115.95444372091531, 33.34115588091772),
             (113.29043149454532, 36.08752551007768), (115.59920554232842, 30.365124619588624),
             (109.72517064814225, 33.727504966991575), (114.97847175500675, 29.16895317796064),
             (115.48038406454742, 32.27310335125954), (124.66282305681797, 27.5141777819288),
             (119.94183145883865, 28.720695770786566), (109.92814807298096, 28.802166715699276),
             (113.85285045276869, 31.085679517129876), (110.89063582401819, 31.984709213129022),
             (117.23604685170484, 32.05858291446838), (120.8455537911695, 29.66662835328746),
             (103.25760195062347, 28.40798398575842), (124.5288292762347, 31.446813975443643),
             (118.76776836055663, 32.45893890327334), (117.01595557253624, 33.666948546432536),
             (97.95854155576856, 22.855723884403663), (96.40742132549937, 30.893797173515203),
             (110.27992763343178, 31.829766592052806), (114.01153949016849, 31.42541939884668),
             (106.98265209885439, 28.679597864397433), (125.61003681311053, 28.832215738160073),
             (119.94320881408404, 31.24404285989995), (116.07828883182303, 29.083632717194003),
             (113.2869857596657, 31.474953579172965), (113.54488915451303, 35.09048757731396),
             (121.71024580860679, 28.356500833143954), (108.99016476228118, 34.04313323680335),
             (112.36036028730624, 27.97499984126215), (119.59918335132346, 28.890996773479085),
             (105.59025637206308, 29.672752979901816), (121.82093672165226, 34.23524842194904),
             (119.92121218649174, 28.680506709671416), (112.75914309355528, 31.554314271635608),
             (109.18097279355143, 31.71083038788257), (117.11545967891706, 30.582766788969753),
             (110.3497231475573, 30.50039177997137), (120.61011694376856, 34.67781894733559),
             (112.03738639192142, 34.216358972444816), (108.09140037692528, 32.20836695983563),
             (123.14232945456536, 31.058045326415463), (115.894457957809, 33.63529711620783),
             (114.44696631344216, 24.27256647965459), (119.49264152031856, 27.511505256659234),
             (120.22216245041977, 31.969687486511273), (115.73613063572371, 35.98327325914592),
             (115.15047799900033, 27.469122418581872), (116.2936947041568, 34.84442961373386),
             (116.50581049653339, 37.93183403643491), (114.54774900637206, 33.95093716734104),
             (120.03524755486407, 31.400971195250033), (101.4216057921766, 27.08651981327195),
             (109.45735271747398, 30.484129093502766), (120.60986077609466, 32.32496655985642),
             (116.25232259788282, 35.609664658136715), (113.17257684367367, 33.05479500595575),
             (102.41177644331904, 34.34732019599947), (107.00623171109702, 29.612519153879063),
             (119.26004849875589, 31.84108774754117), (96.4610556706253, 28.01708866336284),
             (117.84947614468142, 27.425908906393058), (102.08377420554113, 32.71732884634142),
             (113.21774296434037, 29.813357559144826), (121.3708648028369, 37.051479661921796),
             (107.38962656305029, 30.56029736465525), (117.83912674717145, 36.131941451768235),
             (98.71161925486773, 37.348177040894456), (115.8457679147884, 31.752109402896053),
             (107.76194837571961, 31.792340966969153), (117.84731656582004, 28.939928400483925),
             (116.22674397548589, 31.145576135515125), (112.35656971366048, 39.27281817697759),
             (121.00673732722476, 34.195611534809316), (118.69281343432027, 27.310184810236592),
             (104.48300556344766, 25.961162692576778), (112.49412949010132, 26.98522599089462),
             (113.0137189048567, 35.890736097729466), (109.14756352077534, 28.605412319386744),
             (123.98355440696315, 29.820694236214973), (114.09142584422183, 26.221281376162178),
             (115.32362810875235, 38.005658067712325), (110.13108312460905, 27.63850040309487),
             (113.11550566318827, 40.03722066049299), (107.16713828624323, 33.86525546267019),
             (109.00411148699288, 30.064322880314204), (123.49040014296806, 32.281038046630925),
             (111.93806922434013, 28.17453348149481), (116.37031210452838, 35.55457112649074),
             (117.23818153089039, 32.25852084791422), (109.72257755404367, 37.40318500364774),
             (107.22534413957592, 35.145064670540805), (121.5407159985424, 37.838499939615126),
             (115.50529429014614, 36.55360382217482), (111.704955936529, 33.09453920730283),
             (103.13199116308311, 35.148516251132385), (112.21738434572106, 27.670440492782692),
             (120.09414383356511, 31.330577993896316), (121.54947852222203, 34.37420668765651),
             (125.3804726522638, 31.975309463804166), (115.25756102290983, 30.467911409952613),
             (114.08968719616175, 29.67484595014221), (123.05289650373201, 34.38425669302916),
             (112.85519458949464, 40.04823873841875), (125.30314313343833, 29.983457081213015),
             (122.15291874070536, 33.20911432350415), (109.3892080729651, 37.701879601405814),
             (126.97976427693591, 28.328985627911358), (108.51690557054542, 27.69617576975144),
             (124.01325470853595, 37.221879100062765), (121.93521813830752, 33.45888127478612),
             (131.56801686444516, 33.25131054340745), (113.31769210455846, 38.55710263907683),
             (116.17366769334004, 30.505179579256033), (123.48963565344349, 30.88106882667529),
             (112.87620886833763, 33.77210864960943), (108.8917381792258, 30.911033798210326),
             (116.19092353275464, 29.381360648121404), (123.52390848638672, 35.584773646190705),
             (120.5652753472081, 28.42593214516833), (119.75838997650446, 29.10928992998292),
             (114.16612245357796, 34.294763786103154), (123.19746184651358, 35.92284194571426),
             (96.23228650313698, 31.367199339593167), (121.20295819701262, 36.28897006154233),
             (117.57876526660982, 28.254182257304915), (103.23435630615056, 33.575474770286085),
             (123.74870602448992, 33.524865349603), (115.55924816081236, 31.496058071072916),
             (131.3271677521274, 30.679506284530238), (120.73514884908755, 28.52193803048285),
             (122.53932431600043, 33.15196492208691), (124.99270082098309, 31.353978816751432),
             (113.01266063790449, 30.866637334203904), (93.73304983652102, 34.147315163734454),
             (123.74749105754141, 27.065065264414407), (114.33564510995517, 32.896020360598456),
             (114.05641053446244, 30.39493629412264), (121.42146138012127, 29.25391273771441),
             (113.03010564255463, 34.51753819593523), (122.93658127698939, 29.928724289227777),
             (117.17600563019694, 33.21974221423309), (125.56955840696604, 33.305911879245606),
             (119.45514579160809, 28.669560169347044), (112.23501836847089, 32.88098836620987),
             (114.54052473847885, 31.196190746963072), (116.71550938873641, 34.208495003717246),
             (118.43920870366581, 27.356495123788985), (111.6586299590026, 33.6469210830026),
             (115.43832859810843, 32.028106699595895), (118.90623731818992, 28.726899171458584),
             (127.00300011663364, 35.41191739740348), (116.31784652536176, 33.8063568780232),
             (113.74886484174364, 28.942340846885873), (100.73145698777114, 27.141314757076465),
             (115.77110405859848, 29.799939408934293), (87.39959366549185, 30.449532757568683),
             (119.9327094087286, 34.20021249717848), (123.92137830634448, 25.454790433033768)]
    data_analysis = DataAnalysisManager()
    # label_value = [15, 25, 55, 20]
    # labels = ['刀片', '长纤维', '毛团纱', '总缺陷']
    # data_analysis.bar_generation(label_value, labels)
    # data_analysis.plot_generation("", "", "")
    data_analysis.pie_generation("", "")
